// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1
import "core" 1.0
import "core/Constants.js" as Constant

MainPage {
    id: optionPageC
    property bool loadVolume: false;
    Column{
        id: grid
        anchors.verticalCenter: parent.verticalCenter
        anchors.horizontalCenter: parent.horizontalCenter
        spacing: 10

        Column{
            width: Constant.phoneWidth*2/3
            Text{
                width: Constant.phoneWidth*2/3
                height:50
                horizontalAlignment: Text.AlignHCenter
                verticalAlignment: Text.AlignVCenter
                color: "white"
                text: "Clear Save Game"
                MouseArea{
                    anchors.fill: parent
                    onClicked: {
                        var db = openDatabaseSync("Lines98DB", "1.0", "Local Lines 98 SQL!", 1000000);
                        db.transaction(
                                    function(tx) {
                                        tx.executeSql('DROP TABLE IF EXISTS SavedGame');
                                    }
                                    )
                        dialog.show("Saved Game Clear");
                    }
                }
            }

            Text{
                width: Constant.phoneWidth*2/3
                height:50
                horizontalAlignment: Text.AlignHCenter
                verticalAlignment: Text.AlignVCenter
                color: "white"
                text: "Reset Highscore"
                MouseArea{
                    anchors.fill: parent
                    onClicked: {
                        var db = openDatabaseSync("Lines98DB", "1.0", "Local Lines 98 SQL!", 1000000);
                        db.transaction(
                                    function(tx) {
                                        tx.executeSql('DROP TABLE IF EXISTS HighScore');
                                    }
                                    )
                        dialog.show("Highscore Clear");
                    }
                }
            }
        }

        Text{
            text: "Sound Effect"
            color: "white"
        }
        Slider {
            id: soundSlider
            width: Constant.phoneWidth*2/3
            value: soundVolume
            maximum: 1.0
            minimum: 0.0
            onValueChanged: {
                soundVolume = soundSlider.value;
            }
        }
        Text{
            text: "Background Music"
            color: "white"
        }

        Slider {
            id: backgroundSlider
            width: Constant.phoneWidth*2/3
            value: backgroundVolume
            maximum: 1.0
            minimum: 0.0
            onValueChanged: {
                //volumeChanged(backgroundSlider.value, soundSlider.value);
                backgroundVolume = backgroundSlider.value;
            }
        }
    }
    onLoadVolumeChanged: {
        backgroundSlider.value = backgroundVolume;
    }

    Dialog { id: dialog; anchors.centerIn: parent; z: 21; autoClose: true }
}

